package com.example.module_home.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.lib_common.view.entity.ServiceEntity
import com.example.module_home.databinding.HotServiceItemBinding

//class HotServiceAdapter(private val data: List<ServiceEntity>):RecyclerView.Adapter<HotServiceAdapter.HotItemViewHolder>() {
//
//}
class HotServiceAdapter(private val data:List<ServiceEntity>):RecyclerView.Adapter<HotServiceAdapter.HotItemViewHolder>(){

    inner class HotItemViewHolder(val itemDataBinding:HotServiceItemBinding):RecyclerView.ViewHolder(itemDataBinding.root)
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): HotServiceAdapter.HotItemViewHolder {
        return HotItemViewHolder(HotServiceItemBinding.inflate(LayoutInflater.from(parent.context)))
    }

    override fun onBindViewHolder(holder: HotServiceAdapter.HotItemViewHolder, position: Int) {
        val entity= data[position]

        holder.itemDataBinding.entity = entity
        holder.itemDataBinding.executePendingBindings()
    }

    override fun getItemCount(): Int {
        return data.size
    }


}